package javaBase.nowcoder.HJ56_A_完全数计算;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        Integer n = Integer.parseInt(br.readLine());
        int sum = 0;
        int count = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j < i / 2 + 1; j++) {
                if (i % j == 0) {
                    sum += j;
                }
            }
            if (i == sum) {
                count++;
            }
            sum = 0;
        }
        System.out.println(count);
    }
}
